Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to zipfile calls to hopefully make bandit happy #275

Merged
merged 5 commits into from
Feb 17, 2025

Conversation

camipacifici
Copy link
Contributor

extractall does not check for relative or absolute paths and bandit is not happy about it.
I modified the calls with either extract that is supposed to drop the relative/absolute paths or a filter in extractall where possible. Lets see!

This notebook checklist has been made available to us by the the Notebooks For All team.
Its purpose is to serve as a guide for both the notebook author and the technical reviewer highlighting critical aspects to consider when striving to develop an accessible and effective notebook.

The First Cell

  • The title of the notebook in a first-level heading (eg. <h1> or # in markdown).
  • A brief description of the notebook.
  • A table of contents in an ordered list (1., 2., etc. in Markdown).
  • The author(s) and affiliation(s) (if relevant).
  • The date first published.
  • The date last edited (if relevant).
  • A link to the notebook's source(s) (if relevant).

The Rest of the Cells

  • There is only one H1 (# in Markdown) used in the notebook.
  • The notebook uses other heading tags in order (meaning it does not skip numbers).

Text

  • All link text is descriptive. It tells users where they will be taken if they open the link.
  • All acronyms are defined at least the first time they are used.
  • Field-specific/specialized terms are used when needed, but not excessively.

Code

  • Code sections are introduced and explained before they appear in the notebook. This can be fulfilled with a heading in a prior Markdown cell, a sentence preceding it, or a code comment in the code section.
  • Code has explanatory comments (if relevant). This is most important for long sections of code.
  • If the author has control over the syntax highlighting theme in the notebook, that theme has enough color contrast to be legible.
  • Code and code explanations focus on one task at a time. Unless comparison is the point of the notebook, only one method for completing the task is described at a time.

Images

  • All images (jpg, png, svgs) have an image description. This could be

    • Alt text (an alt property)
    • Empty alt text for decorative images/images meant to be skipped (an alt attribute with no value)
    • Captions
    • If no other options will work, the image is decribed in surrounding paragraphs.
  • Any text present in images exists in a text form outside of the image (this can be alt text, captions, or surrounding text.)

Visualizations

  • All visualizations have an image description. Review the previous section, Images, for more information on how to add it.

  • Visualization descriptions include

    • The type of visualization (like bar chart, scatter plot, etc.)
    • Title
    • Axis labels and range
    • Key or legend
    • An explanation of the visualization's significance to the notebook (like the trend, an outlier in the data, what the author learned from it, etc.)
  • All visualizations and their parts have enough color contrast (color contrast checker) to be legible. Remember that transparent colors have lower contrast than their opaque versions.

  • All visualizations convey information with more visual cues than color coding. Use text labels, patterns, or icons alongside color to achieve this.

  • All visualizations have an additional way for notebook readers to access the information. Linking to the original data, including a table of the data in the same notebook, or sonifying the plot are all options.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@camipacifici
Copy link
Contributor Author

Tested locally and bandit seems happy now.

@camipacifici
Copy link
Contributor Author

Fixed also the other bandit complaints. Will probably need to fix some PEP8

@camipacifici
Copy link
Contributor Author

@bhilbert4 all the PEP8 failures are on notebooks that still use simulated data. Do you want them fixed or we can skip since these notebooks need to change anyway at some point?

@bhilbert4
Copy link
Collaborator

Do the plots still look ok for the bad escape sequence PEP8 failures?

@camipacifici
Copy link
Contributor Author

I have not touched any of that code, so I presume it still plots as it plotted before.

@bhilbert4
Copy link
Collaborator

I was worried that the plot labels may have already been broken, but they look ok. In that case, it seems ok to me to ignore the PEP8 warnings. Hopefully we'll get this notebook overhauled/replaced soon.

@camipacifici
Copy link
Contributor Author

@bhilbert4 can you please approve if you are ok with this?

Copy link
Collaborator

@bhilbert4 bhilbert4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Any lingering PEP8 issues will go away when the notebooks are revised/replaced.

@camipacifici camipacifici merged commit 66bafc6 into spacetelescope:main Feb 17, 2025
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants